<?php
//查询退款
require_once 'sign.php';
$param = file_get_contents('php://input');
$param = json_decode($param, true);
$out_refund_no = $param['out_refund_no'];
if (empty($out_refund_no)) {
    echo json_encode([
        "code" => 1,
        "msg" => "请传退款订单号"
    ]);
}
// $timestamp = 1719889433;
$timestamp = time();
// 开发者填入自己的小程序 app_id
$appId = "ttdd96ab2b42a07b6d01";
$nonceStr = randStr(10);
$keyVersion = "3";
$url = "/api/apps/trade/v2/merchant_audit_callback";
$data = json_encode([

    "out_refund_no" => $out_refund_no,
    "refund_audit_status" => 1,
    "deny_message" => ""//备注
]);
$byteAuthorization = getByteAuthorization($url, $data, $appId, $nonceStr, $timestamp, $keyVersion);
$res = sign_post('https://developer.toutiao.com/api/apps/trade/v2/merchant_audit_callback', $byteAuthorization, $data);
$res = json_decode($res, true);
if ($res['err_no'] == 0) {
    echo json_encode([
        'code' => 1,
        'msg' => 'ok'
    ]);
    exit;
} else {
    echo json_encode([
        'code' => 0,
        'err_msg' => $res['err_tips']
    ]);
    exit;
}

